#pragma once

#define BUTTON_X_ANCHOR ((glutGet(GLUT_WINDOW_WIDTH) - 430) / 2)
#define BUTTON_Y_ANCHOR (glutGet(GLUT_WINDOW_HEIGHT) - 40)

struct Button
{
	int x, y, width, height;
    GLfloat *color;
    std::string text;

    Button(std::string TEXT = "NULL", int X = 0, int Y = 0, int W = 0, int H = 0, GLfloat *color = 0): // Default values
		text(TEXT), x(X), y(Y), width(W), height(H), color(color){}
};

struct ClickData
{
    int button, state, x,  y;

    ClickData():
        button(-1), state(-1), x(-1), y(-1) {}
};

class GUI
{
	public:
		GUI();
        
		bool Update();

		void Render();
        void ReceiveClickData(int button, int state, int x, int y);

		bool shouldInsert() {return cdBuffer.button == 0;}
        unsigned int getBrush() {return brush;}

        POINT mouse();

	private:
		void RenderButton(int x, int y, int width, int height, GLfloat *color, std::string text);
        void ClearClickData();
        void ButtonPress(const char *name);

        ClickData cdBuffer;
		std::vector<Button> buttons;

        unsigned int brush;
};